package com.example.activityjump;

import static com.example.activityjump.R.*;
import static com.example.activityjump.R.id.button1;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;

import java.net.URI;

public class dial extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(layout.activity_dial);
        findViewById(R.id.button2).setOnClickListener(this);
        findViewById(R.id.button3).setOnClickListener(this);
        findViewById(R.id.button4).setOnClickListener(this);
    }

    /**
     * Called when a view has been clicked.
     *
     * @param v The view that was clicked.
     */
    @Override
    public void onClick(View v) {

        if (v.getId() == id.button2) {
            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_DIAL);
            Uri uri = Uri.parse("tel:"+123456);
            intent.setData(uri);
            startActivity(intent);
        }
        else if (v.getId() == id.button3) {
            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_SENDTO);
            Uri uri2 = Uri.parse("tel:" + 15215083);
            intent.setData(uri2);
            startActivity(intent);
        }
        else if (v.getId() == id.button4) {
            Intent intent = new Intent(this, MainActivity.class);
            startActivity(intent);
        }

    }
}